package com.sfdcj.se.meta.field;

import java.util.HashMap;

import com.sforce.soap._2006._04.metadata.CustomField;

/*
 <fields>
 <fullName>Field9__c</fullName>
 <label>�����O�e�L�X�g�G���A</label>

 <length>32000</length>

 <type>LongTextArea</type>

 <visibleLines>3</visibleLines>
 </fields>
 */

public class LongTextAreaType extends FieldType {

	static final String TYPE = "LongTextArea";

	public int length;

	public int lines;

	public LongTextAreaType() {
		super();
	}

	public void appendXML() {
		buf.append("<type>" + TYPE + "</type>");
		buf.append("<length>" + length + "</length>");
		buf.append("<visibleLines>" + lines + "</visibleLines>");
	}

	@Override
	public String getTypeName() {
		return TYPE;
	}

	@Override
	public Object clone() {
		return new LongTextAreaType();
	}

	@Override
	public void setAttributes(HashMap<String, String> attributes) {
		lines = Integer.valueOf(attributes.get("lines")).intValue();
		length = Integer.valueOf(attributes.get("length")).intValue();
	}

	@Override
	public CustomField toCustomField() {
		CustomField field = new CustomField();
		field.setFullName(objectFullname + "." + fullname);
		field.setLabel(label);
		field.setLength(new Integer(length));
		field.setVisibleLines(new Integer(lines));
		field.setType(com.sforce.soap._2006._04.metadata.FieldType.LongTextArea);
		return field;
	}
}
